package com.bwie.kafka;

import com.bwie.common.exception.BusinessException;
import com.bwie.common.result.Result;
import com.bwie.common.utils.SmsUtil;
import com.bwie.common.utils.StringUtils;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import java.util.Random;

@Component
public class SendMsgKafka {
    @KafkaListener(topics = "sendMsg")
    public void sendMsgKafka(String phone){
        if(StringUtils.isBlank(phone)){
            throw new BusinessException(Result.error("手机号不能为空"));
        }
        SmsUtil smsUtil = new SmsUtil();
        smsUtil.sendSmsCode(phone,"6666");
    }
}
